package com.example.day1030_standardevents.slice;

import com.example.day1030_standardevents.ResourceTable;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.window.dialog.ToastDialog;
import ohos.multimodalinput.event.KeyEvent;
import ohos.multimodalinput.event.TouchEvent;
import ohos.multimodalinput.standard.KeyEventHandle;
import ohos.multimodalinput.standard.MultimodalEventHandle;

public class MainAbilitySlice extends AbilitySlice {
    private Button BtnBack;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);

        BtnBack = (Button) findComponentById(ResourceTable.Id_btn_back);
        BtnBack.setTouchEventListener(backtouch);

    }
    Component.TouchEventListener backtouch = new Component.TouchEventListener() {
        @Override
        public boolean onTouchEvent(Component component, TouchEvent touchEvent) {
            present(new TestBackSlice(), new Intent());

            return false;
        }
    };


    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
